/*
* @Author: Adolphus.Yao
* @Date:   2019-10-12 14:38:41
* @Last Modified by:   Adolphus.Yao
* @Last Modified time: 2019-10-12 14:38:41
*/
package main

import (
    "fmt"
    "os"

    "github.com/Luxurioust/excelize"
)

func main() {
    xlsx := excelize.NewFile()
    // Create a new sheet.
    xlsx.CopySheet(2, xlsx.NewSheet("Sheet2"))
    // Set value of a cell.
    xlsx.SetCellValue("Sheet2", "A2", "Hello world.")
    xlsx.SetCellValue("Sheet1", "B2", 100)
    // Set active sheet of the workbook.
    xlsx.SetActiveSheet(2)
    // Save xlsx file by the given path.
    err := xlsx.SaveAs("./Workbook.xlsx")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}
